/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.CascadeType;


/**
 *
 * @author Randall Chia
 */
@Entity
public class TransactionEntry implements Serializable {

    private static long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Temporal(TemporalType.TIMESTAMP)
    private Calendar time_stamp;
    private String customerEmail; //the email of customer, which is the pk
    private Integer loyaltyPointsAwarded;
    private Double subtotal;
    @OneToMany (cascade = {CascadeType.PERSIST})
    private List<PurchasedItem> items = new ArrayList<PurchasedItem>();
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    /**
     * @return the loyaltyPointsAwarded
     */
    public Integer getLoyaltyPointsAwarded() {
        return loyaltyPointsAwarded;
    }

    /**
     * @param loyaltyPointsAwarded the loyaltyPointsAwarded to set
     */
    public void setLoyaltyPointsAwarded(Integer loyaltyPointsAwarded) {
        this.loyaltyPointsAwarded = loyaltyPointsAwarded;
    }

    /**
     * @return the subtotal
     */
    public Double getSubtotal() {
        return subtotal;
    }

    /**
     * @param subtotal the subtotal to set
     */
    public void setSubtotal(Double subtotal) {
        this.subtotal = subtotal;
    }

    /**
     * @return the time_stamp
     */
    public Calendar getTime_stamp() {
        return time_stamp;
    }

    /**
     * @param time_stamp the time_stamp to set
     */
    public void setTime_stamp(Calendar time_stamp) {
        this.time_stamp = time_stamp;
    }

    /**
     * @return the customerEmail
     */
    public String getCustomerEmail() {
        return customerEmail;
    }

    /**
     * @param customerEmail the customerEmail to set
     */
    public void setCustomerEmail(String customerEmail) {
        this.customerEmail = customerEmail;
    }

    /**
     * @return the items
     */
    public List<PurchasedItem> getItems() {
        return items;
    }

    /**
     * @param items the items to set
     */
    public void setItems(List<PurchasedItem> items) {
        this.items = items;
    }

  
}
